package cn.com.jrr.core.service.power;


import cn.com.jrr.core.dao.impl.BaseDaoImpl;
import cn.com.jrr.core.model.power.SysRoleResource;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysRoleResourceService {
	@Resource
    private BaseDaoImpl<SysRoleResource> baseDaoImpl;
		
	public List<SysRoleResource> getRoleResc(Integer resourceId, Integer roleId){
		String sql="SELECT * FROM sysroleresource WHERE resourceId=? and roleId=?";
		List<SysRoleResource> sysRoleResources=baseDaoImpl.findBySql(sql,SysRoleResource.class, new Object[]{resourceId,roleId});
		return sysRoleResources;
	}
	public void saveRoleResource(SysRoleResource sysRoleResource){
		baseDaoImpl.save(sysRoleResource);
	}
	public void delete(Integer roleId){
		baseDaoImpl.updateBySql("DELETE FROM sysroleresource WHERE roleId=?", roleId);
	}
	
}
